home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trusted Irix /B 4.0.4
/
Trusted-Irix B-4.0.1.iso
/
dist
/
eoe1.idb
/
usr
/
include
/
sys
/
signal.h.z
/
signal.h
Wrap
C/C++ Source or Header
|
1992-04-03
|
13KB
|
410 lines
/* Copyright (C) 1989,1990 Silicon Graphics, Inc. All rights reserved. */
#ifndef __SYS_SIGNAL_H__
#define __SYS_SIGNAL_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Copyright (c) 1984 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
/* #ident "$Revision: 3.45 $" */
/* ANSI C Notes:
*
* - THE IDENTIFIERS APPEARING OUTSIDE OF #ifdef __EXTENSIONS__ IN THIS
* standard header ARE SPECIFIED BY ANSI! CONFORMANCE WILL BE ALTERED
* IF ANY NEW IDENTIFIERS ARE ADDED TO THIS AREA UNLESS THEY ARE IN ANSI's
* RESERVED NAMESPACE. (i.e., unless they are prefixed by __[a-z] or
* _[A-Z]. For external objects, identifiers with the prefix _[a-z]
* are also reserved.)
*
* - Section 4.7 indicates that identifiers beginning with SIG or SIG_
* followed by an upper-case letter are added to the reserved namespace
* when including <signal.h>.
*/
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt (rubout) */
#define SIGQUIT 3 /* quit (ASCII FS) */
#define SIGILL 4 /* illegal instruction (not reset when caught)*/
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGIOT 6 /* IOT instruction */
#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */
#define SIGEMT 7 /* EMT instruction */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGBUS 10 /* bus error */
#define SIGSEGV 11 /* segmentation violation */
#define SIGSYS 12 /* bad argument to system call */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#define SIGUSR1 16 /* user defined signal 1 */
#define SIGUSR2 17 /* user defined signal 2 */
#define SIGCLD 18 /* death of a child */
#define SIGCHLD SIGCLD /* 4.3BSD's name */
#define SIGPWR 19 /* power-fail restart */
/* 4.3BSD job control */
#define SIGSTOP 20 /* sendable stop signal not from tty */
#define SIGTSTP 21 /* stop signal from tty */
#define SIGPOLL 22 /* pollable event occurred */
/* 4.3BSD signals */
#define SIGIO 23 /* input/output possible signal */
#define SIGURG 24 /* urgent condition on IO channel */
#define SIGWINCH 25 /* window size changes */
#define SIGVTALRM 26 /* virtual time alarm */
#define SIGPROF 27 /* profiling alarm */
/* 4.3BSD job control */
#define SIGCONT 28 /* continue a stopped process */
#define SIGTTIN 29 /* to readers pgrp upon background tty read */
#define SIGTTOU 30 /* like TTIN for output if (tp->t_local<OSTOP) */
/* 4.3BSD CPU- and Filesize-limit signals */
#define SIGXCPU 31 /* Cpu time limit exceeded */
#define SIGXFSZ 32 /* Filesize limit exceeded */
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
#if defined(__EXTENSIONS__) || defined(_POSIX_SOURCE)
/*
* Definitions for POSIX signal system calls
*/
typedef unsigned long sigset_t;
typedef struct sigaction {
#if defined(_LANGUAGE_C_PLUS_PLUS)
#if defined(_BSD_COMPAT) || defined(_BSD_SIGNALS)
int (*sa_handler)(int,...); /* SIG_DFL, SIG_IGN, BSD_SIG_IGN or *fn */
#else
void (*sa_handler)(int,...); /* SIG_DFL, SIG_IGN, BSD_SIG_IGN or *fn */
#endif /* BSD */
#else /* not C++ */
# if defined(_BSD_COMPAT) || defined(_BSD_SIGNALS)
int (*sa_handler)(); /* SIG_DFL, SIG_IGN, BSD_SIG_IGN or *fn */
# else
void (*sa_handler)(); /* SIG_DFL, SIG_IGN, BSD_SIG_IGN or *fn */
# endif /* BSD */
#endif /* C++ */
sigset_t sa_mask; /* additional set of sigs to be */
/* blocked during handler execution */
int sa_flags; /* see below for values */
} sigaction_t;
/* sa_flags values */
#define SA_NOCLDSTOP 0x1 /* if set in parent, don't send SIGCLD */
/* to parent when child stop */
#define _SA_BSDCALL 0x2 /* if set, a clr NOCLDSTOP doesn't set */
/* SJCTRL bit in proc struct. */
#define SA_ONSTACK 0x4 /* handle this signal on sigstack */
/*
* Structure used in sigstack call.
*/
struct sigstack {
char *ss_sp; /* signal stack pointer */
int ss_onstack; /* current status */
};
/*
* Definitions for the "how" parameter to sigprocmask():
*
* The parameter specifies whether the bits in the incoming mask are to be
* added to the presently-active set for the process, removed from the set,
* or replace the active set.
*/
#define SIG_NOP 0 /* Not using 0 will catch some user errors. */
#define SIG_BLOCK 1
#define SIG_UNBLOCK 2
#define SIG_SETMASK 3
#endif /* __EXTENSIONS__ || _POSIX_SOURCE */
/* The following typdefs SIG_PF as a function returning a ptr to:
* a) void with 1 or more parameters for ANSI,
* b) int with old style (no parameters specified) declaration for BSD,
* c) void with old style (no params specified) dec. for regular c.
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)
# if (defined(_BSD_COMPAT) || defined(_BSD_SIGNALS))
typedef int (*SIG_PF) (int, ...);
# else
typedef void (*SIG_PF) (int, ...);
# endif /* BSD */
#else /* not C++ */
# if defined(_BSD_COMPAT) || defined(_BSD_SIGNALS)
typedef int (*SIG_PF) ();
# else
typedef void (*SIG_PF) ();
#endif /* BSD */
# endif /* C++ */
/* next 4 are for C or C++ */
#define SIG_ERR ((SIG_PF)-1)
#define SIG_IGN ((SIG_PF)1)
#define SIG_HOLD ((SIG_PF)2)
#define SIG_DFL ((SIG_PF)0)
#else /* then for assembly or FORTRAN inclusion */
#define SIG_ERR (-1)
#define SIG_IGN (1)
#define SIG_HOLD (2)
#define SIG_DFL (0)
#endif /* C || C++ */
#if defined (_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
typedef int sig_atomic_t; /* for ANSI && c++ et all */
#endif
#if defined(__EXTENSIONS__) && !defined(_POSIX_SOURCE)
/*
* BSD and POSIX treat SIG_IGN of SIGCHLD like SysV's SIG_DFL, so we flag it
* differently FOR INTERNAL USE ONLY. This allows the kernel to treat it
* like SysV's SIG_DFL, but identify it as BSD's SIG_IGN, enabling sigvec
* and sigaction to return SIG_IGN in signal-handling queries.
*/
#ifdef _KERNEL
#define BSD_SIG_IGN (void (*)())(3)
#endif /* _KERNEL */
/* For some reason, NSIG is 1 more than the # of signals supported in system */
#define NSIG 33 /* valid signal numbers are from 1 to NSIG-1 */
#define MAXSIG (NSIG-1) /* actual # of signals == 32 for now */
#define NUMSIGS (NSIG-1) /* for POSIX array sizes, true # of sigs */
#if _LINT
#undef SIG_ERR
#define SIG_ERR (void(*)())0
#undef SIG_IGN
#define SIG_IGN (void (*)())0
#undef SIG_HOLD
#define SIG_HOLD (void (*)())0
#undef BSD_SIG_IGN
#define BSD_SIG_IGN (void (*)())0
#endif /* _LINT */
/* The following definitions are only used by kernel */
#ifdef _KERNEL
#define SIGNO_MASK 0xff
#define SIGDEFER 0x100
#define SIGHOLD 0x200
#define SIGRELSE 0x400
#define SIGIGNORE 0x800
#define SIGPAUSE 0x1000
/* Possible save/restore interfaces encountered when issuing a signal */
#define SIG_TRAP 0
#define SIG_SYSCALL 1
#endif /* _KERNEL */
/* Convert signal number to bit mask representation */
#define sigmask(sig) (1L << ((sig)-1))
#define BRK_USERBP 0 /* user bp (used by debuggers) */
#define BRK_KERNELBP 1 /* kernel bp (used by prom) */
#define BRK_ABORT 2 /* abort(3) uses to cause SIGIOT */
#define BRK_BD_TAKEN 3 /* for taken bd emulation */
#define BRK_BD_NOTTAKEN 4 /* for not taken bd emulation */
#define BRK_SSTEPBP 5 /* user bp (used by debuggers) */
#define BRK_OVERFLOW 6 /* overflow check */
#define BRK_DIVZERO 7 /* divide by zero check */
#define BRK_RANGE 8 /* range error check */
#define BRK_MULOVF 1023 /* multiply overflow detected */
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* sigaltstack info */
#define MINSIGSTKSZ 512
#define SIGSTKSZ 8192
struct sigaltstack {
char *ss_sp;
int ss_size;
int ss_flags;
};
typedef struct sigaltstack stack_t;
/* defines for ss_flags */
#define SS_ONSTACK 0x00000001
#define SS_DISABLE 0x00000002
/*
* Information pushed on stack when a signal is delivered. This is used by
* the kernel to restore state following execution of the signal handler.
* It is also made available to the handler to allow it to properly restore
* state if a non-standard exit is performed.
*
* sc_regmask is examined by the kernel when doing sigcleanup()'s
* and indicates which registers to restore from sc_regs
* bit 0 == 1 indicates that all coprocessor state should be restored
* for each coprocessor that has been used
* bits 1 - 31 == 1 indicate registers 1 to 31 should be restored by
* sigcleanup from sc_regs.
*
* NOTE: the libc routines setjmp/longjmp must agree with this.
*/
struct sigcontext {
int sc_regmask; /* regs to restore in sigcleanup */
int sc_mask; /* signal mask to restore */
int sc_pc; /* pc at time of signal */
/*
* General purpose registers
*/
int sc_regs[32]; /* processor regs 0 to 31 */
/*
* Floating point coprocessor state
*/
int sc_ownedfp; /* fp has been used */
int sc_fpregs[32]; /* fp regs 0 to 31 */
int sc_fpc_csr; /* floating point control and status reg */
int sc_fpc_eir; /* floating point exception instruction reg */
int sc_mdhi; /* Multiplier hi and low regs */
int sc_mdlo;
/*
* System coprocessor registers at time of signal
*/
int sc_cause; /* cp0 cause register */
int sc_badvaddr; /* cp0 bad virtual address */
int sc_badpaddr; /* cpu bd bad physical address */
int is_sigset;
int sc_triggersave; /* state of graphics trigger (SGI IP5 only) */
int sc_ssflags; /* signal stack state to restore */
};
/*
* The next section contains declarations and typedefs for the BSD signal
* library routines built on top of the POSIX system calls. Two of them,
* signal() and sigpause(), share names with their SysV counterparts, yet
* have different semantics. By default, the SysV versions are used.
* In order to use the BSD versions, you may either:
* 1) explicitly call BSDsignal() and BSDsigpause() in the program, or
* 2) set one of the _BSD_SIGNALS or _BSD_COMPAT cpp constants before
* including the signal header file. There are 2 methods:
* a) modify the source file, e.g.,
* #ifdef sgi
* #define _BSD_SIGNALS
* #endif
* #include <signal.h>
* b) use the cc(1) option -D_BSD_SIGNALS or -D_BSD_COMPAT.
* e.g., cc -D_BSD_SIGNALS foo.c -o foo
* Note that _BSD_COMPAT affects other header files that deal with BSD
* compatibility.
*/
#ifndef _KERNEL
#include <sys/types.h>
#if defined(_BSD_COMPAT) || defined(_BSD_SIGNALS)
struct sigvec {
#if defined(_LANGUAGE_C_PLUS_PLUS)
int (*sv_handler)(int,...); /* SIG_DFL, SIG_IGN, BSD_SIG_IGN or *fn */
#else
int (*sv_handler)(); /* *handler, SIG_DFL, SIG_IGN, or BSD_SIG_IGN */
#endif /* C */
int sv_mask; /* mask to use during handler execution */
int sv_flags; /* see signal options below */
};
#define SV_ONSTACK 0x0001
#define SV_INTERRUPT 0x0002 /* not supported */
#define sv_onstack sv_flags /* compatibility with BSD */
#define NUMBSDSIGS (NSIG-1) /* Currently==MAXSIG, but won't ever expand */
#define signal BSDsignal
#define sigpause BSDsigpause
#ifdef __cplusplus
#ifndef __SYS_SIGNAL_H_SIGNAL__
#define __SYS_SIGNAL_H_SIGNAL__
extern int (*signal(int,int (*)(int, ...)))(int, ...);
#endif /* __SYS_SIGNAL_H_SIGNAL__ */
#else
#ifndef __SYS_SIGNAL_H_SIGNAL__
#define __SYS_SIGNAL_H_SIGNAL__
extern int (*signal(int,int (*)()))();
#endif /* __SYS_SIGNAL_H_SIGNAL__ */
#endif
extern int sigpause(int);
extern int sigvec(int,struct sigvec *, struct sigvec *);
extern int sigstack(struct sigstack *, struct sigstack *);
extern int sigblock(int);
extern int sigsetmask(int);
extern int killpg(int, int);
extern int kill(int, int);
#else
#ifdef __cplusplus
#ifndef __SYS_SIGNAL_H_SIGNAL__
#define __SYS_SIGNAL_H_SIGNAL__
extern void (*signal(int,void (*)(int, ...)))(int, ...);
#endif /* __SYS_SIGNAL_H_SIGNAL__ */
#else
#ifndef __SYS_SIGNAL_H_SIGNAL__
#define __SYS_SIGNAL_H_SIGNAL__
extern void (*signal(int,void (*)()))();
#endif /* __SYS_SIGNAL_H_SIGNAL__ */
#endif
extern int sigpause(int);
extern int sighold(int);
extern int sigrelse(int);
extern int kill(pid_t, int);
#endif /* BSD */
#ifndef __cplusplus
#ifdef __STDC__
/* declare signal for ANSI. NOTE! no arg information for the handler function
is specified! DON'T MESS WITH THIS!
*/
#ifndef __SYS_SIGNAL_H_SIGNAL__
#define __SYS_SIGNAL_H_SIGNAL__
extern void (*signal(int,void (*)()))();
#endif /* __SYS_SIGNAL_H_SIGNAL__ */
#endif /* __STDC__ */
#endif /* __cplusplus */
#endif /* !_KERNEL */
#endif /* _LANGUAGE_C || _LANGUAGE_C_PLUS_PLUS */
#endif /* __EXTENSIONS__ && !_POSIX_SOURCE */
#if defined(_LANGUAGE_C) && !defined(_KERNEL)
/* declare signal for C. NOTE! no arg information for the handler function
is specified! DON'T MESS WITH THIS!
*/
#ifndef __SYS_SIGNAL_H_SIGNAL__
#define __SYS_SIGNAL_H_SIGNAL__
extern void (*signal(int,void (*)()))();
#endif /* __SYS_SIGNAL_H_SIGNAL__ */
#endif /* _LANGUAGE_C && !_KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* !__SYS_SIGNAL_H__ */